
import { z } from 'zod';

const envSchema = z.object({
  NODE_ENV: z.enum(['development', 'production']).default('development'),
  PORT: z.coerce.number().default(9001), // 强制类型转换
  LOG_LEVEL: z.enum(['error', 'warn', 'info']).default('info'),
  HOST: z.string().default('0.0.0.0'),
  LOG_RETENTION: z.number().default(15)
});

export const env = envSchema.parse(process.env); // 启动时验证类型